/*
    函数的参数的类型
    1、基本类型
    2、数组类型
    3、对象类型
    4、参数的默认值
    5、可选参数
    6、不定参数
*/
function fun1(arg1:string,arg2:number,arg3:boolean){
    console.log(arg1,arg2,arg3);
}
fun1("1",2,true)
function fun2(ary:number[]){
    console.log(ary);
}
fun2([1,3,4,3])
function fun3(arg:{name:string,age:number}){
    console.log(arg);
}
fun3({name:'Giles',age:23})

class Student{
    nickName
    age
    constructor(nickName:string,age:number){
        this.nickName=nickName
        this.age=age
    }
}

function fun4(arg:Student){
    console.log(arg);
}

fun4(new Student("Giles",33))
console.log('*********************************');
function fun5(name:string,age:number=18){
    console.log(name,age);
}
fun5('Giles',39)
fun5('Monica')
console.log('*************可选参数****************');
enum SEX{
    male=1,
    fmale=2
}
function fun6(name:string,age:number=18,sex?:SEX){
    console.log(!sex?"保密":sex==1?"男":sex==2?"女":'');
}
fun6("Giles",39)
// fun6("Lily",28,0)
// fun6("Monica",28)

function fun7(...arg2:number[]){
    //console.log('arg1',arg1);
    //console.log('arg2',arg2);
    console.log([...arg2,8,9]);
}
fun7(1,2,3)